class Cpanel::IntroducesController < Cpanel::BaseController


  def edit
    @introduce = Introduce.find params[:id]

  end

  def update
    @introduce = Introduce.find params[:id]
    if @introduce.update_attributes introduce_params
      redirect_to "/cpanel/introduces/show/#{@introduce.flag}/#{@introduce.language}", notice: 'updated success'
    else
      flash["notice"] = "updated failed"
      render 'edit'
    end
  end

  def show
    @introduce = Introduce.flag(params[:flag]).language(params[:language]).first
  end

  private

  def introduce_params
    params.require(:introduce).permit(:content, :flag)
  end

 end
